import { lazy } from 'react'
import { Navigate } from 'react-router-dom'

import AuthComponent from './AuthComponent'

var Index = lazy(() => import('../views/Index/Index'))
var Login = lazy(() => import('../views/Login/Login'))
var NotFound = lazy(() => import('../views/NotFound/NotFound'))
var Swiper = lazy(() => import('../views/Index/Swiper/Swiper'))
var SwiperAdd = lazy(() => import('../views/Index/Swiper/SwiperAdd'))
var Users = lazy(() => import('../views/Index/Users/Users'))
var Echarts = lazy(() => import('../views/Index/Echarts/Echarts'))
var Edit = lazy(() => import('../views/Index/Edit/Edit'))
var Map = lazy(() => import('../views/Index/Map/Map'))
var Home = lazy(() => import('../views/Index/Home/Home'))
var Excell = lazy(() => import('../views/Index/Excell/Excell'))

var ProList = lazy(() => import('../views/Index/Pro/ProList'))
var ProRecommend = lazy(() => import('../views/Index/Pro/ProRecommend'))
var ProSeckill = lazy(() => import('../views/Index/Pro/ProSeckill'))
var SearchPro = lazy(() => import('../views/Index/Pro/SearchPro'))


export default [
    {
        path: '/index',
        element: <Index />,
        children: [
            {
                path: '/index/home',
                element: <AuthComponent perm="0"><Home /></AuthComponent>,
            },
            {
                path: '/index/swiper',
                element: <AuthComponent perm="0-0-0"><Swiper /></AuthComponent>,
            },
            {
                path: '/index/swiperadd',
                element: <AuthComponent perm="0-0-1"><SwiperAdd /></AuthComponent>,
            },
            {
                path: '/index/users',
                element: <AuthComponent perm="0-1-0"><Users /></AuthComponent>,
            },
            {
                path: '/index/ProList',
                element: <AuthComponent perm="0-2-0"><ProList /></AuthComponent>,
            },
            {
                path: '/index/ProRecommend',
                element: <AuthComponent perm="0-2-2"><ProRecommend /></AuthComponent>,
            },
            {
                path: '/index/ProSeckill',
                element: <AuthComponent perm="0-2-1"><ProSeckill /></AuthComponent>,
            },
            {
                path: '/index/SearchPro',
                element: <AuthComponent perm="0-2-3"><SearchPro /></AuthComponent>,
            },
            {
                path: '/index/echarts',
                element: <AuthComponent perm="0-3-0"><Echarts /></AuthComponent>,
            },
            {
                path: '/index/edit',
                element: <AuthComponent perm="0-4-0"><Edit /></AuthComponent>,
            },
            {
                path: '/index/map',
                element: <AuthComponent perm="0-6-0"><Map /></AuthComponent>,
            },
            {
                path: '/index/excell',
                element: <AuthComponent perm="0-5-0"><Excell /></AuthComponent>,
            },
            {
                path: '*',
                element: <NotFound />
            }
        ]
    },
    {
        path: '/login',
        element: <Login />
    },
    {
        path: '/',
        element: <Navigate to="/index/home" />
    },
    {
        path: '*',
        element: <NotFound />
    },
]